cmake_minimum_required(VERSION 3.0.0)
project(test1 VERSION 0.1.0)

include(CTest)
enable_testing()

add_compile_options(-std=c++17)


IF (CMAKE_SYSTEM_NAME MATCHES "Linux")
    set(LIBRARYS  ${PROJECT_SOURCE_DIR}/../../base/lib_creat/linux/libbase.so)
ELSEIF (CMAKE_SYSTEM_NAME MATCHES "Windows")
    set(LIBRARYS  ${PROJECT_SOURCE_DIR}/../../base/lib_creat/windows/libbase.dll)
ENDIF ()

link_libraries( 
    ${LIBRARYS}
)

include_directories(
    ${PROJECT_SOURCE_DIR}/../../base/include
)

add_executable(test1 
    main.cpp
)

 # 把动态库添加到运行目录
 add_custom_command (TARGET test1 PRE_BUILD
 COMMAND ${CMAKE_COMMAND} -E copy_if_different
 ${LIBRARYS} $<TARGET_FILE_DIR:test1>
 )

set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
include(CPack)

# message(${PROJECT_SOURCE_DIR}../../base/lib_creat/)